package string;
/**
 * java.lang.StringBuilder专门用于编辑字符串内容的工具类
 * 其内部维护一个可变的char数组
 *
 */
public class StringBuilderDemo {
    public static void main(String[] args) {
        StringBuilder builder1=new StringBuilder("abcdf");
        String a="fgdshfb";
        StringBuilder builder2=new StringBuilder(a);
        String c = builder1.toString();
        String d =builder2.toString();
        System.out.println(c+"\t"+d);

        String str= "好好学习java,为了找到好工作";
        StringBuilder stb=new StringBuilder(str);
        stb.append(",世界和平");
        System.out.println(stb);
        stb.replace(17,21,"骗你的,为了发财");
        System.out.println(stb);
        stb.delete(16,stb.length());
        System.out.println(stb);
        stb.insert(16,"还是为了赚钱");
        stb.insert(16,",");
        System.out.println(stb);
        stb.reverse();//反转
        System.out.println(stb);
    }
}
